Skip to content

feat(copilot): add the platform subagent - #6395

Open
j15z wants to merge 5 commits into
feat/docs-vfs-search-docsfrom
feat/platform-agent
Open

feat(copilot): add the platform subagent#6395
j15z wants to merge 5 commits into
feat/docs-vfs-search-docsfrom
feat/platform-agent

Conversation

@j15z

@j15z j15z commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Interactive Copilot sessions can now delegate Sim product and account questions to a platform subagent, paired with simstudioai/mothership#417 and stacked on #6389. The agent receives live billing and enterprise-access context through shared application operations, while public and headless workflows are rejected before protected lookup.

  • The platform subagent and generated tool contracts are registered and displayed.
  • Billing subscription and usage resolve once per snapshot, with the matching credit scope read directly.
  • One canonical organization-role schema fails closed on invalid stored roles.
  • search_docs remains the platform agent's docs tool, and the @Docs compatibility path remains intact.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • 18 focused Sim suites pass (320 tests).
  • API validation and cross-repository tool-catalog freshness pass.
  • Repository-wide type-check remains blocked only by the unchanged resource-vfs.ts OrchestrationErrorCode: "invalid" errors inherited from mship-fixes.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

N/A — this PR changes Copilot routing and protected server context without introducing a visual UI.

Stack

Base: feat/docs-vfs-search-docs (#6389). Merge after the docs/search pair.

Post-Deploy Monitoring & Validation

  • For 24 hours, watch platform-agent routing, protected-context authorization failures, and headless rejection counts.
  • Healthy behavior: interactive workspace chat can explain billing and access; public or headless execution cannot read either context.
  • Roll back this platform layer if protected reads appear outside interactive Copilot or routing error rates rise.

@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 13, 2026 7:11pm

Request Review

@cursor

cursor Bot commented Aug 8, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Exposes billing and enterprise access-control snapshots to Copilot, but only via delegated interactive sessions with workspace read checks; broader surface area and permission projection logic warrant careful review.

Overview
Introduces the platform Copilot subagent (generated catalog/schemas, Platform Agent labels/icons in chat) for isolated Sim product questions, alongside new server tools get_account_billing and get_enterprise_context that answer plan/usage/credits and workspace/org/permission-group snapshots for the current user.

Those live reads run only in interactive Copilot (copilotInteractionMode stamped by the server; headless lifecycles fail closed) and go through a platform-context application layer with Copilot delegation, workspace authorization, and resolveVerifiedUserAccessControlContext so enterprise restrictions match the Access Control editor.

Write vs Admin deploy is clarified in permissions docs (run vs deploy); PLATFORM_FEATURES is centralized for group-detail UI and active restriction prose. organizationRoleSchema is shared across API contracts with stricter parsing in org settings access.

Reviewed by Cursor Bugbot for commit 51e8300. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Registers the client-side half of the new context-isolated Platform subagent, intended to be deployed with its paired Mothership implementation.

  • Adds platform to the generated tool catalog, runtime schema, and subagent ID types.
  • Adds Platform Agent labels and icon metadata to workspace message rendering and tool-display utilities.
  • Moves Sim product-documentation delegation onto a dedicated subagent contract with a required self-contained task.

Confidence Score: 5/5

The client-side changes appear safe to merge as part of the explicitly paired Platform-agent deployment.

The generated catalog and schema agree on the new subagent contract, routing is derived from the catalog, and the relevant workspace display paths all recognize the platform identifier.

Important Files Changed

Filename Overview
apps/sim/lib/copilot/generated/tool-catalog-v1.ts Adds the Platform subagent’s catalog entry, unions, and registry mapping consistently with existing subagent definitions.
apps/sim/lib/copilot/generated/tool-schemas-v1.ts Adds the matching runtime schema requiring a self-contained string task.
apps/sim/lib/copilot/tools/tool-display.ts Adds the human-readable Platform Agent title to the central tool-title map.
apps/sim/app/workspace/[workspaceId]/home/types.ts Adds the Platform Agent label used by workspace subagent rendering and dispatch recognition.
apps/sim/app/workspace/[workspaceId]/home/components/message-content/utils.ts Assigns the Library icon to Platform agent groups in message content.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Copilot[Copilot orchestrator] -->|platform task| Catalog[Generated tool catalog]
  Catalog -->|route: subagent| Mothership[Mothership]
  Mothership --> Platform[Platform agent]
  Platform -->|subagent events| Workspace[Workspace message UI]
  Workspace --> Label[Platform Agent label]
  Workspace --> Icon[Library icon]
Loading

Reviews (1): Last reviewed commit: "feat(copilot): describe platform agent d..." | Re-trigger Greptile

Comment thread apps/sim/lib/copilot/tools/handlers/enterprise-context.ts Outdated
j15z and others added 5 commits August 13, 2026 12:05
Adds the no-argument get_account_billing tool: the handler combines the
org-aware billing lookups (usage data, credit balance, usage-limit info)
into one snapshot — plan, current-period usage vs limit with remaining,
and purchased credit balance — always scoped to the requesting user.
Catalog and schema mirrors regenerated from the mothership definitions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 51e8300. Configure here.

canRun: true,
canDeploy: canAdmin && !allDeploymentSurfacesHidden,
canManageWorkspace: canAdmin,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read users marked canRun

Medium Severity

get_enterprise_context hardcodes canRun to true for every viewer, including Read. That conflicts with the permissions docs in this PR (Read cannot run; Write can) and with editor gating that treats run as write. The platform agent will tell Read users they can run workflows when they cannot.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 51e8300. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant